init{
  BooleanConverter booleanConverter=new BooleanConverter();
  addConversionHandler(boolean.class,booleanConverter);
  addConversionHandler(Boolean.class,booleanConverter);
  addConversionHandler(File.class,new FileConverter());
  addConversionHandler(Dependency.class,new DependencyIdConverter());
  addConversionHandler(URL.class,new URLConverter());
  addConversionHandler(JavaResource[].class,javaResourceConversionHandler);
  addConversionHandler(JavaResource.class,new ConversionHandler(){
    @Override public Object convertFrom(    final Object obj){
      JavaResource[] res=(JavaResource[])javaResourceConversionHandler.convertFrom(obj);
        if (getCurrentProject().hasFacet(JavaSourceFacet.class)) {
          JavaSourceFacet java=getCurrentProject().getFacet(JavaSourceFacet.class);
            JavaResource resource=java.getJavaResource(obj.toString());
            throw new RuntimeException(e);
        return res[0];
    @Override @SuppressWarnings("rawtypes") public boolean canConvertFrom(    final Class type){
      return javaResourceConversionHandler.canConvertFrom(type);
  addConversionHandler(Resource[].class,resourceConversionHandler);
  addConversionHandler(Resource.class,new ConversionHandler(){
    @Override public Object convertFrom(    final Object o){
      Resource<?>[] res=(Resource<?>[])resourceConversionHandler.convertFrom(o);
        return ResourceUtil.parsePathspec(resourceFactory,getCurrentResource(),o.toString()).get(0);
        return res[0];
    @Override @SuppressWarnings("rawtypes") public boolean canConvertFrom(    final Class aClass){
      return resourceConversionHandler.canConvertFrom(aClass);
  initParameters();
    environment.setProperty("NO_MOTD",true);
    environment.setProperty("NO_MOTD",false);
  environment.setProperty("OS_NAME",OSUtils.getOsName());
  environment.setProperty(PROP_FORGE_CONFIG_DIR,FORGE_CONFIG_DIR);
  environment.setProperty(PROP_PROMPT,"> ");
  environment.setProperty(PROP_PROMPT_NO_PROJ,"> ");
  if (Boolean.getBoolean("forge.offline") == true) {
    environment.setProperty(OFFLINE_FLAG,true);
    environment.setProperty(OFFLINE_FLAG,false);
  initCompleters(pluginCompleter);
  shellConfig.loadHistory(this);
  shellConfig.loadConfig(this);
  initSignalHandlers();
  projectContext.setCurrentResource(resourceFactory.getResourceFrom(event.getWorkingDirectory()));
  environment.setProperty("CWD",getCurrentDirectory().getFullyQualifiedName());
  environment.setProperty("SHELL",this);
}
convertFrom{
  JavaResource[] res=(JavaResource[])javaResourceConversionHandler.convertFrom(obj);
  if (res.length > 1) {
    if (getCurrentProject().hasFacet(JavaSourceFacet.class)) {
      JavaSourceFacet java=getCurrentProject().getFacet(JavaSourceFacet.class);
        JavaResource resource=java.getJavaResource(obj.toString());
        return resource;
 catch (      FileNotFoundException e) {
        throw new RuntimeException(e);
    return res[0];
}
canConvertFrom{
  return javaResourceConversionHandler.canConvertFrom(type);
}
convertFrom{
  Resource<?>[] res=(Resource<?>[])resourceConversionHandler.convertFrom(o);
  if (res.length > 1) {
    return ResourceUtil.parsePathspec(resourceFactory,getCurrentResource(),o.toString()).get(0);
 else {
}
canConvertFrom{
  return resourceConversionHandler.canConvertFrom(aClass);
}
initSignalHandlers{
  try {
 catch (  ClassNotFoundException e) {
}
writeToHistory{
  if (isHistoryEnabled()) {
    try {
      for (int i=0; i < command.length(); i++) {
        historyOutstream.write(command.charAt(i));
      historyOutstream.write(OSUtils.getLineSeparator().getBytes());
      historyOutstream.flush();
 catch (    IOException e) {
}
isHistoryEnabled{
  Object s=environment.getProperty(PROP_HISTORY);
  return Booleans.toBooleanValue(s);
}
setHistoryEnabled{
  environment.setProperty(PROP_VERBOSE,String.valueOf(verbose));
}
isAcceptDefaults{
  Object s=environment.getProperty(PROP_ACCEPT_DEFAULTS);
  return Booleans.toBooleanValue(s);
}
setAcceptDefaults{
  environment.setProperty(PROP_ACCEPT_DEFAULTS,accept);
}
setHistoryOutputStream{
  historyOutstream=stream;
  Runtime.getRuntime().addShutdownHook(new Thread(){
    @Override public void run(){
        historyOutstream.flush();
        historyOutstream.close();
}
run{
  try {
    historyOutstream.flush();
    historyOutstream.close();
 catch (  Exception e) {
}
setHistory{
  if (isNoInitMode()) {
}
_setHistory{
  MemoryHistory history=new MemoryHistory();
  for (  String line : lines) {
    history.add(line);
  reader.setHistory(history);
}
initCompleters{
  List<Completer> completers=new ArrayList<Completer>();
  completers.add(pluginCompleter);
  completer=new AggregateCompleter(completers);
    if (_deferredCompleters == null) {
      _deferredCompleters=new ArrayList<Completer>();
    _deferredCompleters.add(pluginCompleter);
 else {
    _initCompleters(pluginCompleter);
}
_initCompleters{
  this.reader.addCompleter(this.completer);
}
isNoInitMode{
  return Boolean.getBoolean(NO_INIT_SYSTEM_PROPERTY);
}
initReaderAndStreams{
  boolean noInitMode=isNoInitMode();
  if ((_redirectedStream == null) && noInitMode) {
  if ((inputPipe == null) && (_redirectedStream == null)) {
    inputPipe=new ConsoleInputSession(System.in);
  if (outputStream == null) {
    outputStream=System.out;
  Terminal terminal;
    final OutputStream ansiOut=AnsiConsole.wrapOutputStream(outputStream);
    TerminalFactory.configure(TerminalFactory.Type.WINDOWS);
    terminal=TerminalFactory.get();
    outputStream=new OutputStream(){
      @Override public void write(      final int b) throws IOException {
    terminal=TerminalFactory.get();
  this.screenBuffer=new JLineScreenBuffer(terminal,outputStream);
  this.reader=new ConsoleReader(_redirectedStream == null ? inputPipe.getExternalInputStream() : _redirectedStream,this,null,terminal);
  for (  TriggeredAction action : triggeredActions) {
    this.reader.addTriggeredAction(action.getTrigger(),action.getListener());
    if (_historyOverride != null) {
    if (_deferredCompleters != null) {
      for (      Completer completer : _deferredCompleters) {
        _initCompleters(completer);
}
write{
  writer.write(b);
  writer.flush();
}
initParameters{
  if (!isVerbose()) {
    environment.setProperty(PROP_VERBOSE,String.valueOf(parameters.contains("--verbose")));
  if (parameters.contains("--pretend")) {
  if ((parameters != null) && !parameters.isEmpty()) {
}
teardown{
  preShutdown.fire(new PreShutdown(shutdown.getStatus()));
  exitRequested=true;
  if (inputPipe != null) {
}
doShell{
  reader.setPrompt(getPrompt());
      line=readLine();
          writeToHistory(line);
          execute(line);
        reader.setPrompt(getPrompt());
 catch (    Exception e) {
      handleException(e);
}
handleException{
    Throwable root=original;
    while ((root.getCause() != null) && !root.getCause().equals(root)) {
      root=root.getCause();
    if (root instanceof Exception)     throw (Exception)root;
 else     throw new RuntimeException(root);
    Throwable cause=original;
    while (cause.getCause() != null) {
      if (cause instanceof AbortedException)       throw (AbortedException)cause;
      cause=cause.getCause();
    throw cause;
 catch (  AbortedException e) {
    ShellMessages.info(this,"Aborted.");
    if (isVerbose()) {
      e.printStackTrace();
catch (  CommandExecutionException e) {
    ShellMessages.error(this,formatSourcedError(e.getCommand()) + e.getMessage());
    if (isVerbose()) {
      e.printStackTrace();
catch (  CommandParserException e) {
    ShellMessages.error(this,formatSourcedError(e.getCommand()) + e.getMessage());
    if (isVerbose()) {
      e.printStackTrace();
catch (  PluginExecutionException e) {
    ShellMessages.error(this,formatSourcedError(e.getPlugin()) + e.getMessage());
    if (isVerbose()) {
      e.printStackTrace();
catch (  ShellExecutionException e) {
    ShellMessages.error(this,e.getMessage());
    if (isVerbose()) {
      e.printStackTrace();
catch (  Throwable e) {
    if (!isVerbose()) {
}
formatSourcedError{
  return (plugin == null ? "" : ("[" + plugin.toString() + "] "));
}
formatSourcedError{
  String out;
  if (cmd != null) {
    out=cmd.getParent().getName();
    if (!cmd.isDefault())     out+=" " + cmd.getName();
}
readLine{ }
readLine{
  String line;
  if (mask != null) {
 else {
  if ((line != null) && !OSUtils.getLineSeparator().equals(line)) {
    write(OSUtils.getLineSeparator().getBytes());
  flush();
}
scan{
  try {
    return reader.readVirtualKey();
 catch (  IOException e) {
}
clearLine{
  print(new Ansi().eraseLine(Ansi.Erase.ALL).toString());
}
cursorLeft{
  print(new Ansi().cursorLeft(x).toString());
}
ExecutorThread{ }
run{
  fshRuntime.run(run);
}
execute{
        for (        CommandInterceptor interceptor : commandInterceptors) {
          line=interceptor.intercept(line);
        executorThread=new ExecutorThread(line);
        executorThread.run();
        executorThread.join();
 catch (    Exception e) {
      handleException(e);
      executing=false;
      interruptedState=false;
}
interrupt{
  if (executorThread != null) {
    executorThread.interrupt();
    try {
      inputPipe.interruptPipe();
    interruptedState=true;
}
execute{
  StringBuilder buf=new StringBuilder();
  InputStream instream=new BufferedInputStream(new FileInputStream(file));
    byte[] b=new byte[25];
    int read;
    while ((read=instream.read(b)) != -1) {
      for (int i=0; i < read; i++) {
        buf.append((char)b[i]);
    instream.close();
    execute(buf.toString());
  finally {
    ignoreEOF.reset();
    instream.close();
}
execute{
  StringBuilder buf=new StringBuilder();
  String funcName=(file.getName().replaceAll("\\.","_") + "_" + hashCode()).replaceAll("\\-","M");
  buf.append("def ").append(funcName).append('(');
  if (args != null) {
    for (int i=0; i < args.length; i++) {
      buf.append("_").append(i);
      if ((i + 1) < args.length) {
        buf.append(", ");
  buf.append(") {\n");
  if (args != null) {
    for (int i=0; i < args.length; i++) {
      buf.append("@_vararg[").append(i).append("] = ").append("_").append(i).append(";\n");
  InputStream instream=new BufferedInputStream(new FileInputStream(file));
  try {
    buf.append(Streams.toString(instream));
    buf.append("\n}; \n@").append(funcName).append('(');
    if (args != null) {
      for (int i=0; i < args.length; i++) {
          buf.append(", ");
    buf.append(");\n");
    execute(buf.toString());
  finally {
    environment.removeProperty(funcName);
    instream.close();
}
printlnVerbose{
  if ((line != null) && isVerbose()) {
    screenBuffer.write(OSUtils.getLineSeparator().getBytes());
}
print{
  if (output != null) {
    screenBuffer.write(output);
}
println{
  if (line != null) {
    screenBuffer.write(line);
    screenBuffer.write(OSUtils.getLineSeparator().getBytes());
}
println{
    screenBuffer.write(OSUtils.getLineSeparator().getBytes());
    _flushBuffer();
 catch (  IOException e) {
    throw new RuntimeException(e);
}
print{ }
println{ }
printlnVerbose{ }
renderColor{
  Ansi ansi=new Ansi();
    ansi.fg(Ansi.Color.BLACK);
  break;
ansi.fg(Ansi.Color.BLUE);
break;
ansi.fg(Ansi.Color.CYAN);
break;
ansi.fg(Ansi.Color.GREEN);
break;
ansi.fg(Ansi.Color.MAGENTA);
break;
case RED:
ansi.fg(Ansi.Color.RED);
break;
ansi.fg(Ansi.Color.WHITE);
break;
ansi.fg(Ansi.Color.YELLOW);
break;
case BOLD:
ansi.a(Ansi.Attribute.INTENSITY_BOLD);
break;
case ITALIC:
ansi.a(Ansi.Attribute.ITALIC);
ansi.a(Ansi.Attribute.INTENSITY_FAINT);
break;
return ansi.render(output).reset().toString();
}
write{
  screenBuffer.write(b);
}
write{
  screenBuffer.write(b);
}
write{
  screenBuffer.write(b);
}
write{
  screenBuffer.write(b,offset,length);
}
_flushBuffer{
  if (bufferingMode == BufferingMode.Direct) {
    reader.flush();
}
clear{
  print(new Ansi().cursor(0,0).eraseScreen().toString());
}
isExceptionHandlingEnabled{
  Object s=environment.getProperty(PROP_EXCEPTION_HANDLING);
  return Booleans.toBooleanValue(s);
}
setExceptionHandlingEnabled{
  environment.setProperty(PROP_EXCEPTION_HANDLING,String.valueOf(enabled));
}
isVerbose{
  Object s=environment.getProperty(PROP_VERBOSE);
  return Booleans.toBooleanValue(s);
}
setVerbose{
  environment.setProperty(PROP_VERBOSE,String.valueOf(verbose));
}
isPretend{ }
isExecuting{ }
setInputStream{ }
setOutputStream{ }
setDefaultPrompt{ }
setPrompt{
  environment.setProperty(PROP_PROMPT,prompt);
}
getPrompt{
  if (projectContext.getCurrent() != null) {
    return Echo.echo(this,Echo.promptExpressionParser(this,(String)environment.getProperty(PROP_PROMPT)));
 else {
    return Echo.echo(this,Echo.promptExpressionParser(this,(String)environment.getProperty(PROP_PROMPT_NO_PROJ)));
}
getCurrentDirectory{
  Resource<?> r=getCurrentResource();
}
getConfigDir{
  return resourceFactory.getResourceFrom(new File((String)environment.getProperty(PROP_FORGE_CONFIG_DIR))).reify(DirectoryResource.class);
}
getCurrentResource{
    result=this.resourceFactory.getResourceFrom(Files.getWorkingDirectory());
    environment.setProperty("CWD",result.getFullyQualifiedName());
}
getCurrentResourceScope{
  return (Class<? extends Resource<?>>)getCurrentResource().getClass();
}
setCurrentResource{
  lastResource=getCurrentResource();
  projectContext.setCurrentResource(resource);
}
getCurrentProject{ }
getHeight{
  return screenBuffer.getHeight();
}
getAbsoluteHeight{
  return reader.getTerminal().getHeight();
}
getWidth{
  return screenBuffer.getWidth();
}
escapeCode{
  return new Ansi().a(value).fg(Ansi.Color.BLUE).toString();
}
ReturnValueThread{ }
run{
  try {
    try {
      exception=e;
      handleException(e);
 catch (    Exception e2) {
}
getValue{ }
getException{ }
promptWithCompleter{
    if (!message.isEmpty() && message.matches("^.*\\S$")) {
      message=message + " ";
    message=renderColor(ShellColor.CYAN," ? ") + message;
      reader.removeCompleter(this.completer);
      if (tempCompleter != null) {
        reader.addCompleter(tempCompleter);
      reader.setHistoryEnabled(false);
      reader.setPrompt(message);
      flush();
      Callable<String> call=new Callable<String>(){
        @Override public String call() throws Exception {
      ReturnValueThread<String> thread=new ReturnValueThread<String>(call);
      executorThread=thread;
        throw new AbortedException();
      flush();
      if (thread.getException() instanceof EndOfStreamException) {
        throw (EndOfStreamException)thread.getException();
      return thread.getValue();
 catch (    InterruptedException e) {
      throw new RuntimeException("[killed]");
      if (tempCompleter != null) {
        reader.removeCompleter(tempCompleter);
      reader.addCompleter(this.completer);
}
call{ }
promptSecret{
  if (!message.isEmpty() && message.matches("^.*\\S$")) {
    message=message + " ";
  message=renderColor(ShellColor.CYAN," ? ") + message;
    reader.removeCompleter(this.completer);
    reader.setPrompt(message);
    flush();
    String line=readLine('*');
    flush();
    return line;
    reader.addCompleter(this.completer);
}
getPromptTypeConverter{ }
getResourceFactory{ }
setAnsiSupported{
  if (value != isAnsiSupported()) {
    try {
      if (value) {
        configureOSTerminal();
        TerminalFactory.configure(TerminalFactory.Type.NONE);
        TerminalFactory.reset();
 catch (    IOException e) {
}
bufferingMode{
  screenBuffer.bufferOnlyMode();
}
directWriteMode{
  screenBuffer.directWriteMode();
}
flush{
  screenBuffer.flushBuffer();
}
registerBufferManager{ }
getBufferManager{ }
registerKeyListener{
  reader.registerKeyListener(keyListener);
}
configureOSTerminal{
  if (OSUtils.isLinux() || OSUtils.isOSX()) {
    TerminalFactory.configure(TerminalFactory.Type.UNIX);
    TerminalFactory.reset();
    TerminalFactory.configure(TerminalFactory.Type.WINDOWS);
    TerminalFactory.reset();
 else {
    TerminalFactory.configure(TerminalFactory.Type.NONE);
    TerminalFactory.reset();
  initReaderAndStreams();
}
isAnsiSupported{
  return (reader != null) && reader.getTerminal().isAnsiSupported();
}
getEnvironment{ }
getBeanManager{ }
getReader{ }
